<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Yao bo
  Date: 2019/1/21
  Time: 9:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="layuiadmin/layui/css/layui.css">
    <script src="My97DatePicker/WdatePicker.js"></script>
    <script src="js/jquery.min.3.1.0.js"></script>
    <style>
        .account{
            width: 191px;
        }
        .tops{
            width: auto;
            height: 59px;
            background: #009688;
        }
        body{
            background: #9AFF9A;
        }
    </style>
</head>
<body>
<div class="tops"></div>

<!--会员管理修改表单-->
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>会员信息修改</legend>
</fieldset>
<form id="la" class="layui-form" action="../cations">

    <div class="layui-form-item">
        <label class="layui-form-label">会员id</label>
        <div class="layui-input-inline">
            <input type="text"  name="u_id" required lay-verify="required" autocomplete="off" class="layui-input" readonly="readonly" value="${me.uID}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">会员账号</label>
        <div class="layui-input-inline">
            <input type="text" name="account" required lay-verify="required" autocomplete="off" class="layui-input" readonly="readonly" value="${me.uAccount}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">会员名字</label>
        <div class="layui-input-inline">
            <input type="text" name="nickname" required lay-verify="required" autocomplete="off" class="layui-input" readonly="readonly" value="${me.uNickName}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">会员手机号</label>
        <div class="layui-input-inline">
            <input type="text" name="phonenumber" required lay-verify="required" autocomplete="off" class="layui-input" readonly="readonly" value="${me.uPhoneNumber}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">会员邮箱</label>
        <div class="layui-input-inline">
            <input type="text" name="email" required lay-verify="email" autocomplete="off" class="layui-input" value="${me.uEmail}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">会员积分</label>
        <div class="layui-input-inline">
            <input type="text" name="integral" required lay-verify="integral" autocomplete="off" class="layui-input" value="${me.uIntegral}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">单选框</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="0" title="男"<c:if test="${me.uGender==0}">checked</c:if>>
            <input type="radio" name="sex" value="1" title="女"<c:if test="${me.uGender==1}">checked</c:if> >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">用户地址</label>
        <div class="layui-input-block">
            <input type="text" name="address" required  lay-verify="required" autocomplete="off" class="layui-input" value="${me.uAddress}">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo" type="submit">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script src="layuiadmin/layui/layui.js"></script>
<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        form.verify({
            title: function(value){
                if(value.length < 5){
                    return '标题至少得5个字符啊';
                }
            }
            ,email: [
                /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/
                ,'邮箱验证不能为空'
            ]
            ,integral:[
                /^-?[1-9]\d*$/
                ,'不能为空整数'
            ]
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });
        /**
         * 会员信息的修改
         * 监听提交
         */
        form.on('submit(formDemo)', function(data){

           var index = parent.layer.getFrameIndex(window.name);

            $.ajax({
                url:"../cations",   //请求路径
                datatype:"json",//返回的格式
                data:$("#la").serialize(), //参数
                type:"POST", //什么请求
                success:function (data) { //请求成功以后
                    //AJAX成功以后返回的
                    var obj = eval('(' + data + ')');
                    layer.msg(obj.message);
                    //延时500ms关闭窗口
                    setTimeout(function () {
                        parent.layer.close(index);
                    }, 500);
                }
            });
            return false;
        });

    });
</script>
</body>
</html>
